package com.zhishu.generator;

import freemarker.template.TemplateException;

import java.io.File;
import java.io.IOException;
import com.zhishu.model.DataModel;


/**
 * @Author: 止束
 * @Version: 1.0
 * @DateTime: 2025/1/9 14:09
 * @Description:
 */
public class MainGenerator {
    public static void doGenerate(DataModel model) throws TemplateException, IOException {
        String inputRootPath = ".source/springboot-init";
        String outputRootPath = "generated";
        String inputPath;
        String outputPath;

        String password = model.mysqlConfig.password;
        String url = model.mysqlConfig.url;
        String username = model.mysqlConfig.username;
        String description = model.docsConfig.description;
        String title = model.docsConfig.title;
        String version = model.docsConfig.version;
        boolean needDocs = model.needDocs;
        boolean needPost = model.needPost;
        boolean needCors = model.needCors;
        boolean needEs = model.needEs;
        String basePackage = model.basePackage;
        boolean needRedis = model.needRedis;

        // groupKey = post
        if (needPost) {
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/service/PostThumbService.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/service/PostThumbService.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/postfavour/PostFavourQueryRequest.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/postfavour/PostFavourQueryRequest.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/resources/mapper/PostFavourMapper.xml.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/resources/mapper/PostFavourMapper.xml").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/resources/mapper/PostMapper.xml.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/resources/mapper/PostMapper.xml").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/job/once/FullSyncPostToEs.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/job/once/FullSyncPostToEs.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/controller/PostThumbController.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/controller/PostThumbController.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/postthumb/PostThumbAddRequest.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/postthumb/PostThumbAddRequest.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/entity/PostFavour.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/entity/PostFavour.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/postfavour/PostFavourAddRequest.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/postfavour/PostFavourAddRequest.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/entity/Post.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/entity/Post.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/job/cycle/IncSyncPostToEs.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/job/cycle/IncSyncPostToEs.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/service/impl/PostServiceImpl.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/service/impl/PostServiceImpl.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/service/impl/PostThumbServiceImpl.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/service/impl/PostThumbServiceImpl.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/service/impl/PostFavourServiceImpl.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/service/impl/PostFavourServiceImpl.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/post/PostQueryRequest.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/post/PostQueryRequest.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/controller/PostFavourController.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/controller/PostFavourController.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/entity/PostThumb.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/entity/PostThumb.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/mapper/PostFavourMapper.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/mapper/PostFavourMapper.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/controller/PostController.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/controller/PostController.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/mapper/PostMapper.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/mapper/PostMapper.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/service/PostService.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/service/PostService.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/post/PostAddRequest.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/post/PostAddRequest.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/mapper/PostThumbMapper.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/mapper/PostThumbMapper.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/esdao/PostEsDao.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/esdao/PostEsDao.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/vo/PostVO.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/vo/PostVO.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/service/PostFavourService.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/service/PostFavourService.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/post/PostUpdateRequest.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/post/PostUpdateRequest.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/resources/mapper/PostThumbMapper.xml.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/resources/mapper/PostThumbMapper.xml").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/post/PostEditRequest.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/post/PostEditRequest.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
        }
        if (needPost && needEs) {
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/post/PostEsDTO.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/post/PostEsDTO.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
        }
        //输入路径
        inputPath = new File(inputRootPath, "src/test/java/com/yupi/springbootinit/mapper/PostMapperTest.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/test/java/com/yupi/springbootinit/mapper/PostMapperTest.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/wxmp/handler/MessageHandler.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/wxmp/handler/MessageHandler.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "mvnw").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "mvnw").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/test/java/com/yupi/springbootinit/MainApplicationTests.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/test/java/com/yupi/springbootinit/MainApplicationTests.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/exception/BusinessException.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/exception/BusinessException.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/common/PageRequest.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/common/PageRequest.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/config/MyBatisPlusConfig.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/config/MyBatisPlusConfig.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "doc/swagger.png").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "doc/swagger.png").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/enums/UserRoleEnum.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/enums/UserRoleEnum.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "sql/create_table.sql").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "sql/create_table.sql").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/exception/GlobalExceptionHandler.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/exception/GlobalExceptionHandler.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, ".idea/encodings.xml").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, ".idea/encodings.xml").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/vo/LoginUserVO.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/vo/LoginUserVO.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/resources/application-prod.yml").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/resources/application-prod.yml").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/config/CosClientConfig.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/config/CosClientConfig.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/config/WxOpenConfig.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/config/WxOpenConfig.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, ".idea/misc.xml").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, ".idea/misc.xml").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/test/.DS_Store").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/test/.DS_Store").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/common/DeleteRequest.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/common/DeleteRequest.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/wxmp/handler/EventHandler.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/wxmp/handler/EventHandler.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/constant/UserConstant.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/constant/UserConstant.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, ".idea/workspace.xml.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, ".idea/workspace.xml").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/user/UserAddRequest.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/user/UserAddRequest.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/enums/FileUploadBizEnum.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/enums/FileUploadBizEnum.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, ".DS_Store").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, ".DS_Store").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/test/java/com/yupi/springbootinit/service/PostThumbServiceTest.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/test/java/com/yupi/springbootinit/service/PostThumbServiceTest.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/entity/User.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/entity/User.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/common/ResultUtils.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/common/ResultUtils.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        if (needCors) {
            //输入路径
            inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/config/CorsConfig.java.ftl").getAbsolutePath();
            //输出路径
            outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/config/CorsConfig.java").getAbsolutePath();
            //生成动态文件
            DynamicGenerator.doGenerate(inputPath, outputPath, model);
        }
        //输入路径
        inputPath = new File(inputRootPath, ".idea/jarRepositories.xml").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, ".idea/jarRepositories.xml").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/utils/SqlUtils.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/utils/SqlUtils.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "sql/post_es_mapping.json").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "sql/post_es_mapping.json").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/controller/UserController.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/controller/UserController.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "mvnw.cmd").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "mvnw.cmd").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, ".idea/.gitignore").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, ".idea/.gitignore").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/resources/application-test.yml").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/resources/application-test.yml").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "README.md.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "README.md").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/wxmp/WxMpMsgRouter.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/wxmp/WxMpMsgRouter.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/utils/SpringContextUtils.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/utils/SpringContextUtils.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, ".mvn/wrapper/maven-wrapper.properties").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, ".mvn/wrapper/maven-wrapper.properties").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/aop/LogInterceptor.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/aop/LogInterceptor.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/user/UserUpdateRequest.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/user/UserUpdateRequest.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/service/UserService.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/service/UserService.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, ".idea/intellij-javadocs-4.0.1.xml").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, ".idea/intellij-javadocs-4.0.1.xml").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/test/java/com/yupi/springbootinit/manager/CosManagerTest.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/test/java/com/yupi/springbootinit/manager/CosManagerTest.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, ".idea/compiler.xml").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, ".idea/compiler.xml").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/user/UserUpdateMyRequest.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/user/UserUpdateMyRequest.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/test/java/com/yupi/springbootinit/service/UserServiceTest.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/test/java/com/yupi/springbootinit/service/UserServiceTest.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/constant/CommonConstant.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/constant/CommonConstant.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/generate/CodeGenerator.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/generate/CodeGenerator.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/common/ErrorCode.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/common/ErrorCode.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/controller/FileController.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/controller/FileController.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, ".gitignore").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, ".gitignore").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/resources/test_excel.xlsx").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/resources/test_excel.xlsx").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/aop/AuthInterceptor.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/aop/AuthInterceptor.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/service/impl/UserServiceImpl.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/service/impl/UserServiceImpl.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, ".idea/google-java-format.xml").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, ".idea/google-java-format.xml").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/user/UserRegisterRequest.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/user/UserRegisterRequest.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/resources/banner.txt").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/resources/banner.txt").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "pom.xml.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "pom.xml").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/constant/FileConstant.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/constant/FileConstant.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/resources/mapper/UserMapper.xml.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/resources/mapper/UserMapper.xml").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/resources/META-INF/additional-spring-configuration-metadata.json").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/resources/META-INF/additional-spring-configuration-metadata.json").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, ".idea/vcs.xml").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, ".idea/vcs.xml").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/vo/UserVO.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/vo/UserVO.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/user/UserQueryRequest.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/user/UserQueryRequest.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/utils/NetUtils.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/utils/NetUtils.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/MainApplication.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/MainApplication.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/test/java/com/yupi/springbootinit/service/PostFavourServiceTest.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/test/java/com/yupi/springbootinit/service/PostFavourServiceTest.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/controller/WxMpController.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/controller/WxMpController.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/.DS_Store").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/.DS_Store").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/test/java/com/yupi/springbootinit/mapper/PostFavourMapperTest.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/test/java/com/yupi/springbootinit/mapper/PostFavourMapperTest.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/mapper/UserMapper.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/mapper/UserMapper.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/exception/ThrowUtils.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/exception/ThrowUtils.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/manager/CosManager.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/manager/CosManager.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/common/BaseResponse.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/common/BaseResponse.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/wxmp/WxMpConstant.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/wxmp/WxMpConstant.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/file/UploadFileRequest.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/file/UploadFileRequest.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/test/java/com/yupi/springbootinit/utils/EasyExcelTest.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/test/java/com/yupi/springbootinit/utils/EasyExcelTest.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "Dockerfile").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "Dockerfile").getAbsolutePath();
        //生成静态文件
        StaticGenerator.copyFilesByHutool(inputPath, outputPath);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/config/JsonConfig.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/config/JsonConfig.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/wxmp/handler/SubscribeHandler.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/wxmp/handler/SubscribeHandler.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/user/UserLoginRequest.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/model/dto/user/UserLoginRequest.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/resources/application.yml.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/resources/application.yml").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
        //输入路径
        inputPath = new File(inputRootPath, "src/main/java/com/yupi/springbootinit/annotation/AuthCheck.java.ftl").getAbsolutePath();
        //输出路径
        outputPath = new File(outputRootPath, "src/main/java/com/yupi/springbootinit/annotation/AuthCheck.java").getAbsolutePath();
        //生成动态文件
        DynamicGenerator.doGenerate(inputPath, outputPath, model);
    }
}
